home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////
- //
- // Module : INV01.PRG
- //
- // Created by SUMMER'93 (c) on Fri Nov 26 14:50:17 1993
- //
- ///////////////////////////////////////////////////////////////
- #include "snj.ch"
- // The following statics were declared 'PUBLIC' in the S87 code
- // OR were private and inherited by called functions
- // If they are used outside this module there will be a set/get
- // function with the same name as the var in this module
- static PARTPLEN
- // Printing an invoice
- procedure INVOUT( PINVNO ) // Amended by SUMMER93
- // Calls: QBPROMPT QBMESS CEILING QBPRCTL QBTXTMAC QBYESNO
- // Called By: INVMAIN INVEDIT
- // The following locals have been declared by Summer'93
- // NLOOPS I
- local PC, PT, DOIT, NLOOPS, I
-
- PC := chr( 18 ) + chr( 15 )
- PT := chr( 27 ) + ":"
- DOIT := .t.
-
- if QBPROMPT( "Printer Loaded and Online|Quit|" )<> 1
- return
- endif
- if PINVNO = 0
- do QBMESS with "Serious program error - how the hell did we get here?", ;
- COLFLASH() , 15
- endif
-
- do while DOIT
- select PARTLINE
- go top
- NLOOPS := max( int(CEILING(reccount() / 33 )), 1 )
-
- select INVOICE
- do QBPRCTL with "P"
- if GETOUT()
- return
- endif
- for I := 1 to NLOOPS
- do QBTXTMAC with "IVFORMAT.TXT"
- if NLOOPS > I
- if QBYESNO( "More to do - Ready with next Sheet?" ) = "N"
- exit
- endif
- endif
- next
- do QBPRCTL with "R:Invoice printed"
- DOIT := ( QBYESNO("Print this Invoice again?" ) = "Y" )
- enddo
- return
-
- //*****************************************************************
-
- procedure QBTXTMAC( FNAME ) // Amended by SUMMER93
- // Calls: QBMESS ATNEXT
- // Called By: INVOUT
- // uses clipper file reading facilities and
- // Tom Rettig function atnext()
-
- local BUFFER, OCC, OPOS, NPOS, MACLINE
-
- PARTPLEN := 61
- set alternate to INVTRACE.TXT
- set alternate on
- if file( FNAME )
- BUFFER := memoread( FNAME )
- else
- do QBMESS with "Format file for Invoice missing", COLFLASH() , 10
- return
- endif
-
- OCC := OPOS := NPOS := 1
- do while .t.
- NPOS := ATNEXT( chr(13 ), BUFFER, OCC )
- if NPOS = 0
- exit
- endif
- MACLINE := substr( BUFFER, OPOS, NPOS - OPOS )
- do case
- case substr( MACLINE, 1, 1 ) = "*"
- set print off
- do QBMESS with substr(MACLINE, 2 ), COLHEAD() , 0
- set print on
- case substr( MACLINE, 1, 1 ) = "?"
- MACLINE := substr( MACLINE, 2 )
- ?? &MACLINE
- otherwise
- ?&MACLINE
- endcase
- OPOS := NPOS + 2
- OCC := OCC + 1
- enddo
-
- set alternate off
- set alternate to
- return
-
- //*****************************************************************
-
- function PRPART
- // Calls:
- // Called By:
- // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 99 9999.99 9999.99
- local PSTR
-
- PSTR := "" // chr(18)+chr(15) && Set compressed
- select PARTLINE
- if eof( )
- PSTR := space( PARTPLEN )
- else
- PSTR := PSTR + FIELD->PARTDESC + str( FIELD->QTY , 2 ) + space( 1 ) + str;
- ( FIELD->UPRICE , 7, 2 ) + space( 4 ) + str( FIELD->TPRICE , 7, 2 )
- PARTPLEN := len( PSTR )
- skip
- endif
- select INVOICE
- return PSTR // +chr(27)+":" && and set 12CPI
- // End of file
-